#include <iostream>
using namespace std;


void int_printf(int a){
    cout<<a<<endl;
}

void swap1(int *v1,int *v2){
    int tmp=*v1;
    *v1=*v2;
    *v2=tmp;
}


int main() {

    int age=10;
    int *p=&age;


    //age=20;
    *p=20;
    int_printf(age);


    //ref相当于age的别名
    //ref被指定后不能改变指向
    int &ref=age;
    ref=40;
    int_printf(ref);
    ref+=40;
    int_printf(ref);

    int a=10;
    int b=20;
    swap1(&a,&b);
    cout<<"a="<<a<<",b="<<b<<endl;


    return 0;
}
